package models

import (
	"fmt"
	"github.com/go-redis/redis"
	"news/conf"
)

var (
	Rdb *redis.Client
)

func RedisConfig() {
	Rdb = redis.NewClient(&redis.Options{
		Addr:     conf.Conf.RedisConfig.Addr,
		Password: conf.Conf.RedisConfig.Password,
		DB:       conf.Conf.RedisConfig.Db,
	})
	err := Rdb.Ping().Err()
	if err != nil {
		fmt.Println("redis连接失败")
		return
	} else {
		fmt.Println("redis连接成功")
	}
}
